package exp8;

class MyException extends Exception{
	static int count = 0;

	public MyException(String description) {
		super(description);
		count++;
	}

	String show() {
		return "自定义异常出现的次数" +count;
	}
}
public class ExceptionDemo3 {
	static void test() throws MyException {
		MyException me = new MyException("自定义异常");
		throw me;
	}
	public static void main(String[] args) {
		for(int i =0; i<3;i++) {
			try {
				test();
			}catch(MyException e) {
				System.out.println(e.show());
				System.out.println(e.toString());
			}
		}
	}
}
